import {reactive} from "vue";

const userInfrmationRules = reactive({
    userName: [
        {required: true, message: '请输入用户名', trigger: 'blur'},
        {min: 3, max: 20, message: '用户名的长度介于3至20位', trigger: 'blur'},
    ],
    nickName: [
        {required: true, message: '请输入昵称', trigger: 'blur'},
        {min: 3, max: 20, message: '昵称的长度介于3至20位', trigger: 'blur'},
    ],
    signature: [
        {required: false, message: '请输入个人签名', trigger: 'blur'},
        {min: 3, max: 20, message: '签名的长度介于3至50位', trigger: 'blur'},
    ],
    tel: [
        {required: false, message: '请输入个人电话', trigger: 'blur'},
    ],
    email: [
        {required: true, message: '请输入个人邮箱', trigger: 'blur'},
    ],
    age: [
        {required: false, message: '请输入年龄', trigger: 'blur'},
    ],
})

const loginFormRules = reactive({
    userName: [
        {required: true, message: '请输入用户名', trigger: 'blur'},
        {min: 4, max: 20, message: '用户名长度介于4位到20位之间', trigger: 'blur'},
    ],
    password: [
        {required: true, message: '请输入密码', trigger: 'blur'},
        {min: 4, max: 20, message: '密码长度介于4位到20位之间', trigger: 'blur'},
    ],
    code: [
        {required: true, message: '请输入验证码', trigger: 'blur'},
        {length: 4, message: '验证码长度介于4位到20位之间', trigger: 'blur'},
    ],
})

const changePasswordFormRules = reactive({
    oldPwd: [{required: true, message: '旧密码是必填项', trigger: 'blur'}, {
        min: 3,
        max: 20,
        message: '密码长度介于3位至20位',
        trigger: 'blur'
    }],
    newPwd: [{required: true, message: '新密码是必填项', trigger: 'blur'}, {
        min: 3,
        max: 20,
        message: '密码长度介于3位至20位',
        trigger: 'blur'
    }],
    newPwdAgain: [{required: true, message: '新密码是必填项', trigger: 'blur'}, {
        min: 3,
        max: 20,
        message: '密码长度介于3位至20位',
        trigger: 'blur'
    }],
})

export {
    userInfrmationRules, loginFormRules,changePasswordFormRules
}